<html><head><title>Worm plot</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Rchm.css">
</head>
<body>

<table width="100%"><tr><td>wp(gamlss)</td><td align="right">R Documentation</td></tr></table><object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="R:   wp">
<param name="keyword" value=" Worm plot">
</object>


<h2>Worm plot</h2>


<h3>Description</h3>

<p>
Provides single or multiple worm plots for GAMLSS fitted objects. This is 
a diagnostic tool for checking the residuals within different ranges (by default not overlapping) of the explanatory variable
</p>


<h3>Usage</h3>

<pre>
wp(object, xvar = NULL, n.inter = 4, xcut.points = NULL, 
   overlap = 0, xlim.all = 4, xlim.worm = 3.5, 
   show.given = TRUE, line = TRUE, 
   ylim.all = 12 * sqrt(1/length(fitted(object))), 
   ylim.worm = 12 * sqrt(n.inter/length(fitted(object))), 
   cex = 1, pch = 21, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
a GAMLSS fitted object</td></tr>
<tr valign="top"><td><code>xvar</code></td>
<td>
the explanatory variable against which the worm plots will be plotted </td></tr>
<tr valign="top"><td><code>n.inter</code></td>
<td>
the number of intervals in which the explanatory variable <code>xvar</code> will be cut</td></tr>
<tr valign="top"><td><code>xcut.points</code></td>
<td>
the x-axis cut off points e.g. <code>c(20,30)</code>. If <code>xcut.points=NULL</code> then the <code>n.inter</code> argument is activated </td></tr>
<tr valign="top"><td><code>overlap</code></td>
<td>
how much overlapping in the <code>xvar</code> intervals. Default value is <code>overlap=0</code> for non overlapping intervals</td></tr>
<tr valign="top"><td><code>xlim.all</code></td>
<td>
for the single plot, this value is the x-variable limit, default is <code>xlim.all=4</code></td></tr>
<tr valign="top"><td><code>xlim.worm</code></td>
<td>
for multiple plots, this value is the x-variable limit, default is <code>xlim.worm=3.5</code></td></tr>
<tr valign="top"><td><code>show.given</code></td>
<td>
whether to show the x-variable intervals in the top of the graph, default is <code>show.given=TRUE</code> </td></tr>
<tr valign="top"><td><code>line</code></td>
<td>
whether to plot the polynomial line in the worm plot, default value is <code>line=TRUE</code></td></tr>
<tr valign="top"><td><code>ylim.all</code></td>
<td>
for the single plot, this value is the y-variable limit, default value is <code>ylim.all=12*sqrt(1/length(fitted(object)))</code></td></tr>
<tr valign="top"><td><code>ylim.worm</code></td>
<td>
for multiple plots, this values is the y-variable limit, default value is <code>ylim.worm=12*sqrt(n.inter/length(fitted(object)))</code></td></tr>
<tr valign="top"><td><code>cex</code></td>
<td>
the cex plotting parameter with default <code>cex=1</code></td></tr>
<tr valign="top"><td><code>pch</code></td>
<td>
the pch plotting parameter with default <code>pch=21</code> </td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
for extra arguments</td></tr>
</table>

<h3>Details</h3>

<p>
If the <code>xvar</code> argument is not specified then a single worm plot is used. In this case a worm plot is a detrended normal QQ-plot 
so departure from normality is highlighted.
If the  <code>xvar</code> is specified then we have as many worm plot as <code>n.iter</code>. In this case the x-variable is cut into <code>n.iter</code>
intervals with an equal number observations and detrended normal QQ (i.e. worm) plots for each interval are plotted. 
This is a way of highlighting failures of the model within different ranges of the 
explanatory variable. The fitted coefficients from fitting cubic polynomials to the residuals (within each x-variable interval) can be obtain by e.g. 
<code>coeffs&lt;-wp(model1,xvar=x,n.iner=9)</code>.  van Buuren <EM>et al.</EM> (2001) used these residuals to identify regions (intervals) of the 
explanatory variable within which the model does not fit adequately the data (called "model violation")
</p>


<h3>Value</h3>

<p>
For multiple plots the <code>xvar</code> intervals and the coefficients of the fitted cubic polynomials to the residuals (within each <code>xvar</code> interval) are returned.</p>

<h3>Note</h3>




<h3>Author(s)</h3>

<p>
Mikis Stasinopoulos and Bob Rigby
</p>


<h3>References</h3>

<p>
Rigby, R. A. and  Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), <EM>Appl. Statist.</EM>, <B>54</B>, part 3,
1-38. 
</p>
<p>
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R.
Accompanying documentation in the current GAMLSS  help files, (see also  <a href="http://www.gamlss.com/">http://www.gamlss.com/</a>).
</p>
<p>
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
<EM>Journal of Statistical Software</EM>, Vol. <B>23</B>, Issue 7, Dec 2007, <a href="http://www.jstatsoft.org/v23/i07">http://www.jstatsoft.org/v23/i07</a>.
</p>
<p>
van Buuren and Fredriks M. (2001) Worm plot: simple diagnostic device for modelling growth reference curves. 
<EM>Statistics in Medicine</EM>, <B>20</B>, 1259&ndash;1277
</p>


<h3>See Also</h3>

<p>
<code><a href="gamlss.html">gamlss</a></code>, <code><a href="plot.gamlss.html">plot.gamlss</a> </code>
</p>


<h3>Examples</h3>

<pre>
data(abdom)
a&lt;-gamlss(y~cs(x,df=3),sigma.fo=~cs(x,1),family=LO,data=abdom)
wp(a)
coeff1&lt;-wp(a,abdom$x)
coeff1
rm(a,a1)
</pre>



<hr><div align="center">[Package <em>gamlss</em> version 1.7-9 <a href="00Index.html">Index]</a></div>

</body></html>
